import axiosInstance from '@/api/axiosInstance'
interface reductionPlanListParams {
  title?: string
  // 其他查询条件...
}

// 获取减免方案列表
export const getReductionPlanList = async (params?: reductionPlanListParams) => {
  return axiosInstance.get('/admin/reduction-plan', { params })
}

//获取减免方案啊选项
export const getReductionPlanOptions = async () => {
  return axiosInstance.get(`/admin/reduction-plan/options`)
}

// 获取减免方案详情
export const getReductionPlanDetail = async (id: number) => {
  return axiosInstance.get(`/admin/reduction-plan/${id}`)
}
// 创建减免方案
export const createReductionPlan = async (data: any) => {
  return axiosInstance.post('/admin/reduction-plan', data)
}

// 更新减免方案
export const updateReductionPlan = async (id: number, data: any) => {
  return axiosInstance.put(`/admin/reduction-plan/${id}`, data)
}

// 删除减免方案
export const deleteReductionPlan = async (id: number) => {
  return axiosInstance.delete(`/admin/reduction-plan/${id}`)
}

//创建减免项目
export const createReductionPlanItem = async (id: number, data: any) => {
  return axiosInstance.post(`/admin/reduction-plan/${id}/reduction-plan-item`, data)
}

//更新减免项目
export const updateReductionPlanItem = async (id: number, itemId: number, data: any) => {
  return axiosInstance.put(`/admin/reduction-plan/${id}/reduction-plan-item/${itemId}`, data)
}

//删除减免项目
export const deleteReductionPlanItem = async (id: number, itemId: number) => {
  return axiosInstance.delete(`/admin/reduction-plan/${id}/reduction-plan-item/${itemId}`)
}
